package main

import (
	"fmt"
	"strconv"
)

type Hello struct {
	name string
	age  int
}

func PrintArr(arr []int) {
	fmt.Printf("printArr%p\n", arr)

}
func main() {

	fmt.Println(1 & 2)
	fmt.Println(2 & 1)
	fmt.Println(1 | 2)
	fmt.Println(2 | 1)

	fmt.Println(true || true)
	fmt.Println(true || false)
	fmt.Println(false || false)

	fmt.Println(true && true)
	fmt.Println(true && false)
	fmt.Println(false && false)

	var x uint8 = 1<<1 | 1<<5
	var y uint8 = 1<<1 | 1<<2

	fmt.Printf("%08b\n", x) // "00100010", the set {1, 5}
	fmt.Printf("%08b\n", y) // "00000110", the set {1, 2}

	fmt.Printf("%08b\n", x&y)  // "00000010", the intersection {1}
	fmt.Printf("%08b\n", x|y)  // "00100110", the union {1, 2, 5}
	fmt.Printf("%08b\n", x^y)  // "00100100", the symmetric difference {2, 5}
	fmt.Printf("%08b\n", x&^y) // "00100000", the difference {5}

	for i := uint(0); i < 8; i++ {
		if x&(1<<i) != 0 { // membership test
			fmt.Println(i) // "1", "5"
		}
	}

	fmt.Printf("%08b\n", x<<1) // "01000100", the set {2, 6}
	fmt.Printf("%08b\n", x>>1) // "00010001", the set {0, 4}

	var arr [5]int = [5]int{1, 2, 3}

	fmt.Printf("%p\n", &arr)
	PrintArr(arr[:])
	var i int = 0
	// 自增运算符必须是一句单独的执行语句，而不是一个表达式
	i++
	fmt.Println( /*i++*/ i)
	var str = "hello ,世界"

	fmt.Println(str)
	str1 := []rune(str)
	for _, v := range str1 {
		fmt.Println(v)
	}

	fmt.Println(strconv.Atoi("12"))

	fmt.Printf("%T\n", strconv.Itoa(12))

	//testStr := "hello world ,anchanyun"

	//any := strings.ContainsAny(testStr, "l")

}
